<?php

// This Class is for you. 
// Feel free to edit this file to extend your models classes.
// Please, never touch sufixed _protoweb classes

/**
 * 
 *
 * @Authors Sanchez Raul * @package sisco
 * @subpackage model
 */
class Producto extends Producto_protoweb
{

	public function get_id_from_code($codigo){
		if (is_numeric($codigo[0]))
			$search_by = 'ean13';
		else
			$search_by = 'codigo_interno';
		
		$query = $this->db->get_where($this->table, array($search_by => $codigo));

		$arr = $query->result();
		if ($query->num_rows() > 0)
			return $arr[0]->id;
		else
			return 0;
	} // function get_id_from_code

	public function __construct($id = NULL) 
	{
		parent::__construct($id);
	}

} // Class producto

/* End of file producto.php */
/* Location: ./application/models/producto.php */